﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

        //Write a program that reads the coefficients a, b and c of a quadratic 
        //equation ax2+bx+c=0 and solves it (prints its real roots).


namespace _06QuadraticEquation
{
    class _06QuadraticEquation
    {
        static void Main(string[] args)
        {
            Console.WriteLine("Solving the quadratic equation of the form ax^2+bx+c=0");
            Console.Write("a = ");
            double a = double.Parse(Console.ReadLine());
            Console.Write("b = ");
            double b = double.Parse(Console.ReadLine());
            Console.Write("c = ");
            double c = double.Parse(Console.ReadLine());
            double disc = Math.Sqrt(Math.Pow(b, 2) - (4 * a * c));
            double x1 = (-b + disc) / (2 * a);
            double x2 = (-b - disc) / (2 * a);
            Console.WriteLine("The roots are {0:0.00000} and {1:0.00000}.", x1, x2);
            

        }
    }
}
